<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/**
 * Description of banner_model
 * 
 * @author Subha Sundar Das (subhasundar.das@gmail.com)
 */
class Admin_post_model extends CI_Model {

	
	function getPost($status=51,$limit=1,$show=''){
		
		$sql = "Select * from post where status=$status order by (id) DESC limit $limit";
		$query = $this->db->query($sql);
		$result = $query->result();
		if($result){
			return $query->result();
		}else{
			return false;
		}
	}
	
	function changeStatus($id,$status){
		if($status == 1){
		$sql = "Update post set status = 51 where id = $id";
		}
		if($status == 51){
			$sql = "Update post set status = 1 where id = $id";
		}
		$this->db->query($sql);
	}
	
	
}